\(\int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx\) [31]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 122 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {2 a b \cot ^2(c+d x)}{d}-\frac {\left (2 a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {a b \cot ^4(c+d x)}{2 d}-\frac {a^2 \cot ^5(c+d x)}{5 d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]

[Out]

-(a^2+2*b^2)*cot(d*x+c)/d-2*a*b*cot(d*x+c)^2/d-1/3*(2*a^2+b^2)*cot(d*x+c)^3/d-1/2*a*b*cot(d*x+c)^4/d-1/5*a^2*c
ot(d*x+c)^5/d+2*a*b*ln(tan(d*x+c))/d+b^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 122, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.095, Rules used = {3597, 962} \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {\left (2 a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {a^2 \cot ^5(c+d x)}{5 d}-\frac {a b \cot ^4(c+d x)}{2 d}-\frac {2 a b \cot ^2(c+d x)}{d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]^6*(a + b*Tan[c + d*x])^2,x]

[Out]

-(((a^2 + 2*b^2)*Cot[c + d*x])/d) - (2*a*b*Cot[c + d*x]^2)/d - ((2*a^2 + b^2)*Cot[c + d*x]^3)/(3*d) - (a*b*Cot
[c + d*x]^4)/(2*d) - (a^2*Cot[c + d*x]^5)/(5*d) + (2*a*b*Log[Tan[c + d*x]])/d + (b^2*Tan[c + d*x])/d

Rule 962

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIn
tegrand[(d + e*x)^m*(f + g*x)^n*(a + c*x^2)^p, x], x] /; FreeQ[{a, c, d, e, f, g}, x] && NeQ[e*f - d*g, 0] &&
NeQ[c*d^2 + a*e^2, 0] && IGtQ[p, 0] && (IGtQ[m, 0] || (EqQ[m, -2] && EqQ[p, 1] && EqQ[d, 0]))

Rule 3597

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[b/f, Subst[Int
[x^m*((a + x)^n/(b^2 + x^2)^(m/2 + 1)), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[m/
2]

Rubi steps \begin{align*} \text {integral}& = \frac {b \text {Subst}\left (\int \frac {(a+x)^2 \left (b^2+x^2\right )^2}{x^6} \, dx,x,b \tan (c+d x)\right )}{d} \\ & = \frac {b \text {Subst}\left (\int \left (1+\frac {a^2 b^4}{x^6}+\frac {2 a b^4}{x^5}+\frac {2 a^2 b^2+b^4}{x^4}+\frac {4 a b^2}{x^3}+\frac {a^2+2 b^2}{x^2}+\frac {2 a}{x}\right ) \, dx,x,b \tan (c+d x)\right )}{d} \\ & = -\frac {\left (a^2+2 b^2\right ) \cot (c+d x)}{d}-\frac {2 a b \cot ^2(c+d x)}{d}-\frac {\left (2 a^2+b^2\right ) \cot ^3(c+d x)}{3 d}-\frac {a b \cot ^4(c+d x)}{2 d}-\frac {a^2 \cot ^5(c+d x)}{5 d}+\frac {2 a b \log (\tan (c+d x))}{d}+\frac {b^2 \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 2.82 (sec) , antiderivative size = 114, normalized size of antiderivative = 0.93 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {2 \cot (c+d x) \left (8 a^2+25 b^2+\left (4 a^2+5 b^2\right ) \csc ^2(c+d x)+3 a^2 \csc ^4(c+d x)\right )+15 b \left (2 a \csc ^2(c+d x)+a \csc ^4(c+d x)+4 a \log (\cos (c+d x))-4 a \log (\sin (c+d x))-2 b \tan (c+d x)\right )}{30 d} \]

[In]

Integrate[Csc[c + d*x]^6*(a + b*Tan[c + d*x])^2,x]

[Out]

-1/30*(2*Cot[c + d*x]*(8*a^2 + 25*b^2 + (4*a^2 + 5*b^2)*Csc[c + d*x]^2 + 3*a^2*Csc[c + d*x]^4) + 15*b*(2*a*Csc
[c + d*x]^2 + a*Csc[c + d*x]^4 + 4*a*Log[Cos[c + d*x]] - 4*a*Log[Sin[c + d*x]] - 2*b*Tan[c + d*x]))/d

Maple [A] (verified)

Time = 12.76 (sec) , antiderivative size = 119, normalized size of antiderivative = 0.98

method result size
derivativedivides \(\frac {b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )+2 a b \left (-\frac {1}{4 \sin \left (d x +c \right )^{4}}-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {8}{15}-\frac {\left (\csc ^{4}\left (d x +c \right )\right )}{5}-\frac {4 \left (\csc ^{2}\left (d x +c \right )\right )}{15}\right ) \cot \left (d x +c \right )}{d}\) \(119\)
default \(\frac {b^{2} \left (-\frac {1}{3 \sin \left (d x +c \right )^{3} \cos \left (d x +c \right )}+\frac {4}{3 \sin \left (d x +c \right ) \cos \left (d x +c \right )}-\frac {8 \cot \left (d x +c \right )}{3}\right )+2 a b \left (-\frac {1}{4 \sin \left (d x +c \right )^{4}}-\frac {1}{2 \sin \left (d x +c \right )^{2}}+\ln \left (\tan \left (d x +c \right )\right )\right )+a^{2} \left (-\frac {8}{15}-\frac {\left (\csc ^{4}\left (d x +c \right )\right )}{5}-\frac {4 \left (\csc ^{2}\left (d x +c \right )\right )}{15}\right ) \cot \left (d x +c \right )}{d}\) \(119\)
risch \(\frac {4 a b \,{\mathrm e}^{10 i \left (d x +c \right )}-16 a b \,{\mathrm e}^{8 i \left (d x +c \right )}-\frac {32 i a^{2} {\mathrm e}^{6 i \left (d x +c \right )}}{3}+\frac {32 i b^{2} {\mathrm e}^{6 i \left (d x +c \right )}}{3}-\frac {16 i a^{2} {\mathrm e}^{4 i \left (d x +c \right )}}{3}-\frac {80 i b^{2} {\mathrm e}^{4 i \left (d x +c \right )}}{3}+16 a b \,{\mathrm e}^{4 i \left (d x +c \right )}+\frac {64 i a^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{15}+\frac {64 i b^{2} {\mathrm e}^{2 i \left (d x +c \right )}}{3}-4 a b \,{\mathrm e}^{2 i \left (d x +c \right )}-\frac {16 i a^{2}}{15}-\frac {16 i b^{2}}{3}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{5} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}-\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) \(226\)

[In]

int(csc(d*x+c)^6*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(b^2*(-1/3/sin(d*x+c)^3/cos(d*x+c)+4/3/sin(d*x+c)/cos(d*x+c)-8/3*cot(d*x+c))+2*a*b*(-1/4/sin(d*x+c)^4-1/2/
sin(d*x+c)^2+ln(tan(d*x+c)))+a^2*(-8/15-1/5*csc(d*x+c)^4-4/15*csc(d*x+c)^2)*cot(d*x+c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 240 vs. \(2 (116) = 232\).

Time = 0.27 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.97 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=-\frac {16 \, {\left (a^{2} + 5 \, b^{2}\right )} \cos \left (d x + c\right )^{6} - 40 \, {\left (a^{2} + 5 \, b^{2}\right )} \cos \left (d x + c\right )^{4} + 30 \, {\left (a^{2} + 5 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 30 \, {\left (a b \cos \left (d x + c\right )^{5} - 2 \, a b \cos \left (d x + c\right )^{3} + a b \cos \left (d x + c\right )\right )} \log \left (\cos \left (d x + c\right )^{2}\right ) \sin \left (d x + c\right ) - 30 \, {\left (a b \cos \left (d x + c\right )^{5} - 2 \, a b \cos \left (d x + c\right )^{3} + a b \cos \left (d x + c\right )\right )} \log \left (-\frac {1}{4} \, \cos \left (d x + c\right )^{2} + \frac {1}{4}\right ) \sin \left (d x + c\right ) - 30 \, b^{2} - 15 \, {\left (2 \, a b \cos \left (d x + c\right )^{3} - 3 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{30 \, {\left (d \cos \left (d x + c\right )^{5} - 2 \, d \cos \left (d x + c\right )^{3} + d \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )} \]

[In]

integrate(csc(d*x+c)^6*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

-1/30*(16*(a^2 + 5*b^2)*cos(d*x + c)^6 - 40*(a^2 + 5*b^2)*cos(d*x + c)^4 + 30*(a^2 + 5*b^2)*cos(d*x + c)^2 + 3
0*(a*b*cos(d*x + c)^5 - 2*a*b*cos(d*x + c)^3 + a*b*cos(d*x + c))*log(cos(d*x + c)^2)*sin(d*x + c) - 30*(a*b*co
s(d*x + c)^5 - 2*a*b*cos(d*x + c)^3 + a*b*cos(d*x + c))*log(-1/4*cos(d*x + c)^2 + 1/4)*sin(d*x + c) - 30*b^2 -
 15*(2*a*b*cos(d*x + c)^3 - 3*a*b*cos(d*x + c))*sin(d*x + c))/((d*cos(d*x + c)^5 - 2*d*cos(d*x + c)^3 + d*cos(
d*x + c))*sin(d*x + c))

Sympy [F]

\[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=\int \left (a + b \tan {\left (c + d x \right )}\right )^{2} \csc ^{6}{\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)**6*(a+b*tan(d*x+c))**2,x)

[Out]

Integral((a + b*tan(c + d*x))**2*csc(c + d*x)**6, x)

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.85 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {60 \, a b \log \left (\tan \left (d x + c\right )\right ) + 30 \, b^{2} \tan \left (d x + c\right ) - \frac {60 \, a b \tan \left (d x + c\right )^{3} + 30 \, {\left (a^{2} + 2 \, b^{2}\right )} \tan \left (d x + c\right )^{4} + 15 \, a b \tan \left (d x + c\right ) + 10 \, {\left (2 \, a^{2} + b^{2}\right )} \tan \left (d x + c\right )^{2} + 6 \, a^{2}}{\tan \left (d x + c\right )^{5}}}{30 \, d} \]

[In]

integrate(csc(d*x+c)^6*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/30*(60*a*b*log(tan(d*x + c)) + 30*b^2*tan(d*x + c) - (60*a*b*tan(d*x + c)^3 + 30*(a^2 + 2*b^2)*tan(d*x + c)^
4 + 15*a*b*tan(d*x + c) + 10*(2*a^2 + b^2)*tan(d*x + c)^2 + 6*a^2)/tan(d*x + c)^5)/d

Giac [A] (verification not implemented)

none

Time = 0.50 (sec) , antiderivative size = 131, normalized size of antiderivative = 1.07 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {60 \, a b \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 30 \, b^{2} \tan \left (d x + c\right ) - \frac {137 \, a b \tan \left (d x + c\right )^{5} + 30 \, a^{2} \tan \left (d x + c\right )^{4} + 60 \, b^{2} \tan \left (d x + c\right )^{4} + 60 \, a b \tan \left (d x + c\right )^{3} + 20 \, a^{2} \tan \left (d x + c\right )^{2} + 10 \, b^{2} \tan \left (d x + c\right )^{2} + 15 \, a b \tan \left (d x + c\right ) + 6 \, a^{2}}{\tan \left (d x + c\right )^{5}}}{30 \, d} \]

[In]

integrate(csc(d*x+c)^6*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/30*(60*a*b*log(abs(tan(d*x + c))) + 30*b^2*tan(d*x + c) - (137*a*b*tan(d*x + c)^5 + 30*a^2*tan(d*x + c)^4 +
60*b^2*tan(d*x + c)^4 + 60*a*b*tan(d*x + c)^3 + 20*a^2*tan(d*x + c)^2 + 10*b^2*tan(d*x + c)^2 + 15*a*b*tan(d*x
 + c) + 6*a^2)/tan(d*x + c)^5)/d

Mupad [B] (verification not implemented)

Time = 4.95 (sec) , antiderivative size = 107, normalized size of antiderivative = 0.88 \[ \int \csc ^6(c+d x) (a+b \tan (c+d x))^2 \, dx=\frac {b^2\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {{\mathrm {tan}\left (c+d\,x\right )}^4\,\left (a^2+2\,b^2\right )+\frac {a^2}{5}+{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {2\,a^2}{3}+\frac {b^2}{3}\right )+\frac {a\,b\,\mathrm {tan}\left (c+d\,x\right )}{2}+2\,a\,b\,{\mathrm {tan}\left (c+d\,x\right )}^3}{d\,{\mathrm {tan}\left (c+d\,x\right )}^5}+\frac {2\,a\,b\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d} \]

[In]

int((a + b*tan(c + d*x))^2/sin(c + d*x)^6,x)

[Out]

(b^2*tan(c + d*x))/d - (tan(c + d*x)^4*(a^2 + 2*b^2) + a^2/5 + tan(c + d*x)^2*((2*a^2)/3 + b^2/3) + (a*b*tan(c
 + d*x))/2 + 2*a*b*tan(c + d*x)^3)/(d*tan(c + d*x)^5) + (2*a*b*log(tan(c + d*x)))/d